package com.wangbo.rabbit.controller;

import org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@RestController
public class RabbitController {

    @Resource
    SimpleMessageListenerContainer simpleMessageListenerContainer;

    @GetMapping("/rabbit/startConsume")
    public String startConsume() {
        simpleMessageListenerContainer.start();
        return "ok";
    }

    @GetMapping("/rabbit/stopConsume")
    public String stopConsume() {
        simpleMessageListenerContainer.stop();
        return "ok";
    }
}
